inherited fmRSTabel_System: TfmRSTabel_System
  Left = 46
  Top = 49
  Width = 939
  Height = 653
  Caption = 'fmRSTabel_System'
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 629
    Width = 906
  end
  inherited Panel1: TPanel
    Width = 906
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 728
    end
    inherited BitBtn2: TBitBtn
      Left = 816
    end
  end
  object cxPageControl1: TcxPageControl [2]
    Left = 0
    Top = 297
    Width = 906
    Height = 332
    ActivePage = tsEdit
    Align = alBottom
    LookAndFeel.Kind = lfFlat
    LookAndFeel.SkinName = 'Caramel'
    TabOrder = 2
    ClientRectBottom = 326
    ClientRectLeft = 3
    ClientRectRight = 900
    ClientRectTop = 27
    object tsCreate: TcxTabSheet
      Caption = #1044#1077#1090#1080', '#1082#1086#1090#1086#1088#1099#1084' '#1076#1086#1089#1090#1091#1087#1085#1099' '#1076#1072#1085#1085#1099#1077' '#1079#1072#1085#1103#1090#1080#1103
      ImageIndex = 0
    end
    object tsEdit: TcxTabSheet
      Caption = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1085#1080#1077' '#1090#1072#1073#1077#1083#1103
      ImageIndex = 1
    end
  end
  object Panel2: TPanel [3]
    Left = 0
    Top = 45
    Width = 906
    Height = 252
    Align = alTop
    TabOrder = 3
    object Label6: TLabel
      Left = 24
      Top = 127
      Width = 99
      Height = 13
      Caption = #1047#1072#1085#1103#1090#1080#1077' '#1087#1088#1086#1074#1077#1083'(-'#1072')'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object rbIndivid: TcxRadioButton
      Left = 152
      Top = 56
      Width = 137
      Height = 17
      Caption = #1048#1085#1076#1080#1074#1080#1076#1091#1072#1083#1100#1085#1072#1103
      TabOrder = 0
      OnClick = rbGroupClick
    end
    object rbGroup: TcxRadioButton
      Left = 24
      Top = 56
      Width = 113
      Height = 17
      Caption = #1043#1088#1091#1087#1087#1086#1074#1072#1103
      Checked = True
      TabOrder = 1
      TabStop = True
      OnClick = rbGroupClick
    end
    object ltvOsnPodr: TdxLookupTreeView
      Left = 24
      Top = 16
      Width = 265
      Height = 21
      CanSelectParents = True
      ParentColor = False
      TabOrder = 2
      TabStop = True
      TreeViewColor = clWindow
      TreeViewCursor = crDefault
      TreeViewFont.Charset = DEFAULT_CHARSET
      TreeViewFont.Color = clWindowText
      TreeViewFont.Height = -11
      TreeViewFont.Name = 'MS Sans Serif'
      TreeViewFont.Style = []
      TreeViewIndent = 19
      TreeViewReadOnly = False
      TreeViewShowButtons = True
      TreeViewShowHint = False
      TreeViewShowLines = True
      TreeViewShowRoot = True
      TreeViewSortType = stNone
      DividedChar = '.'
      ListSource = dsqOsnPodr
      KeyField = 'SDID'
      ListField = 'SDNAME'
      Options = [trDBCanDelete, trDBConfirmDelete, trCanDBNavigate, trSmartRecordCopy, trCheckHasChildren]
      ParentField = 'SDPARID'
      RootValue = Null
      TextStyle = tvtsShort
      Alignment = taLeftJustify
    end
    object lcbPedag: TcxDBLookupComboBox
      Left = 22
      Top = 150
      DataBinding.DataField = 'PID_PEDAG'
      DataBinding.DataSource = dlgDS
      ParentFont = False
      Properties.DropDownListStyle = lsEditList
      Properties.DropDownRows = 15
      Properties.KeyFieldNames = 'PID'
      Properties.ListColumns = <
        item
          Caption = #1060#1048#1054
          FieldName = 'PP'
        end
        item
          Caption = #1057#1090#1072#1090#1091#1089
          FieldName = 'SDNAME'
        end>
      Properties.ListSource = dsSotr
      Properties.MaxLength = 0
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clBlack
      Style.Font.Height = -15
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.Shadow = False
      Style.IsFontAssigned = True
      TabOrder = 3
      Width = 379
    end
    object cxDateEdit1: TcxDateEdit
      Left = 448
      Top = 152
      TabOrder = 4
      Width = 121
    end
    object cbMKW0: TcxCheckBox
      Left = 32
      Top = 192
      Caption = #1055#1086#1082#1072#1079#1099#1074#1072#1090#1100' '#1076#1077#1090#1077#1081', '#1091' '#1082#1086#1090#1086#1088#1099#1093' '#1082#1086#1083#1080#1095#1077#1089#1090#1074#1086' '#1076#1086#1089#1090#1091#1087#1085#1099#1093' '#1079#1072#1085#1103#1090#1080#1081' = 0'
      Properties.Alignment = taRightJustify
      Properties.MultiLine = True
      TabOrder = 5
      Width = 209
    end
    object bCreate: TcxButton
      Left = 336
      Top = 200
      Width = 113
      Height = 25
      Caption = #1057#1086#1079#1076#1072#1090#1100' '#1090#1072#1073#1077#1083#1100
      TabOrder = 6
      Colors.Default = clMoneyGreen
    end
    object lcbDopPodr: TcxLookupComboBox
      Left = 368
      Top = 88
      Properties.DropDownRows = 15
      Properties.KeyFieldNames = 'SDID'
      Properties.ListColumns = <
        item
          FieldName = 'SDNAME'
        end>
      Properties.ListOptions.ShowHeader = False
      Properties.ListSource = dsqDopPodr
      Properties.OnCloseUp = lcbDopPodrPropertiesCloseUp
      TabOrder = 7
      Width = 193
    end
    object lcbUsluga: TcxLookupComboBox
      Left = 24
      Top = 88
      Properties.DropDownRows = 15
      Properties.KeyFieldNames = 'SDID'
      Properties.ListColumns = <
        item
          FieldName = 'SDNAME'
        end>
      Properties.ListOptions.ShowHeader = False
      Properties.ListSource = dsqUsluga
      Properties.OnCloseUp = lcbUslugaPropertiesCloseUp
      TabOrder = 8
      Width = 257
    end
  end
  object dsSotr: TDataSource
    DataSet = qSotr
    Left = 192
    Top = 176
  end
  object qSotr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT P.PID, (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,' +
        #39' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS PP,'
      '    SD.SDNAME, d.SDID'
      'FROM PEOPLE P'
      'INNER JOIN DOLJNOST_PEOPLE d ON d.PID = P.PID'
      'INNER JOIN DOLJNOST D1 ON d1.DOLID = d.DOLID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = d1.SDID'
      'WHERE P.PISDELETE IS NULL AND d.DOLISDELETE IS NULL'
      
        'AND CURRENT_DATE BETWEEN D.DOLDATEBEGIN AND COALESCE(d.DOLDATEEN' +
        'D, CURRENT_DATE)'
      'ORDER BY 2')
    Left = 224
    Top = 176
    object qSotrPID: TIntegerField
      FieldName = 'PID'
      Origin = '"PEOPLE"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qSotrPP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object qSotrSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSotrSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"P_STATUS"."SDID"'
    end
  end
  object qOsnPodr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT t1.sdparid, t1.sdid, t1.sdname'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, SDISDELETE)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, sd.SDISDELETE FROM' +
        ' SYS_DIC SD'
      '      WHERE sd.SDPARID = 13'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, sd1.SDISDELETE'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID, SDISDELETE FROM tree t'
      ') AS t1'
      'WHERE t1.SDISDELETE = 0'
      'order by 3')
    GeneratorField.Field = 'SDID'
    Left = 360
    Top = 56
    object qOsnPodrSDPARID: TIntegerField
      FieldName = 'SDPARID'
      ProviderFlags = []
    end
    object qOsnPodrSDID: TIntegerField
      FieldName = 'SDID'
      ProviderFlags = []
    end
    object qOsnPodrSDNAME: TIBStringField
      FieldName = 'SDNAME'
      ProviderFlags = []
      Size = 2303
    end
  end
  object dsqOsnPodr: TDataSource
    DataSet = qOsnPodr
    Left = 320
    Top = 56
  end
  object qTree: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsqOsnPodr
    SQL.Strings = (
      'SELECT LIST(t1.sdid, '#39', '#39') AS list_sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID = :SDID'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      'WHERE NOT EXISTS'
      '('
      'SELECT t2.sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID = :SDID'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t2'
      'WHERE t2.sdparid = t1.sdid'
      ')')
    Left = 408
    Top = 56
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SDID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'SDID'
        ParamType = ptUnknown
      end>
    object qTreeLIST_SDID: TMemoField
      FieldName = 'LIST_SDID'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
  end
  object qUsluga: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT t1.sdparid, t1.sdid, t1.sdname'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, SDISDELETE)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, sd.SDISDELETE FROM' +
        ' SYS_DIC SD'
      '      WHERE sd.SDPARID = :SDPARID'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, sd1.SDISDELETE'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID, SDISDELETE FROM tree t'
      ') AS t1'
      'WHERE t1.SDISDELETE = 0'
      'order by 3')
    GeneratorField.Field = 'SDID'
    Left = 360
    Top = 96
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SDPARID'
        ParamType = ptUnknown
      end>
    object IntegerField1: TIntegerField
      FieldName = 'SDPARID'
      ProviderFlags = []
    end
    object IntegerField2: TIntegerField
      FieldName = 'SDID'
      ProviderFlags = []
    end
    object IBStringField1: TIBStringField
      FieldName = 'SDNAME'
      ProviderFlags = []
      Size = 2303
    end
  end
  object dsqUsluga: TDataSource
    DataSet = qUsluga
    Left = 320
    Top = 96
  end
  object qDopPodr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsqUsluga
    SQL.Strings = (
      'SELECT distinct SD.SDID, SD.SDNAME'
      'FROM SERVICES_TYPE ST'
      'INNER JOIN SERV_PODR_LINK SPL ON SPL.STID = ST.STID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = SPL.SDID'
      'WHERE ST.STISDELETE IS NULL'
      'AND ST.STSDIDTABEL = :SDID'
      'AND COALESCE(ST.STISARCHIVE, 0) = 0')
    GeneratorField.Field = 'SDID'
    Left = 632
    Top = 128
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SDID'
        ParamType = ptUnknown
      end>
    object qDopPodrSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qDopPodrSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"SYS_DIC"."SDID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
  end
  object dsqDopPodr: TDataSource
    DataSet = qDopPodr
    Left = 592
    Top = 128
  end
end
